package com.gopay.bis.manager.bank;

import java.util.List;

import com.gopay.common.domain.bank.BankOrder;
import com.gopay.common.domain.bank.BankOrderDealLog;
import com.gopay.common.domain.bank.BankOrderExt;
import com.gopay.common.domain.bank.BankRouteLog;
import com.gopay.common.domain.bank.BcdlQueryBalance;
import com.gopay.common.domain.bank.BcdlSendBankLog;
import com.gopay.common.domain.bank.SendBankOrderCust;
import com.gopay.common.domain.bis.BisBankBcdlOrder;

/**
 * 银行流水MANAGER
 * 
 * @BankOrderManager.java
 * @author yaobo
 * @2013-2-5 下午03:38:30 www.gopay.com.cn Inc.All rights reserved.
 */
public interface BankOrderManager {
	

    /**
     * 新增银行流水
     * @param bankOrder
     * @return
     */
    public BankOrder addBankOrder(BankOrder bankOrder);
    
    /**
     * 新增上送银行信息
     * @param orderCust
     * @return
     */
    public SendBankOrderCust addSendBankOrder(SendBankOrderCust orderCust);
    /**
     * 新增银行流水
     * @param bankOrder
     * @return
     */
    public BisBankBcdlOrder addBankBcdlOrder(BisBankBcdlOrder bankOrder);
    public BisBankBcdlOrder getBankBcdlOrderById(String orderId);
    /**
     * 修改银行流水
     * 
     * @param bankOrder
     */
    public void updateBankOrder(BankOrder bankOrder);

    /**
     * 查找银行流水
     * 
     * @param orderId
     * @return
     */
    public BankOrder getBankOrderById(String outOrderId);
    
    /**
     * 查找银行流水
     * 
     * @param orderId
     * @return
     */
    public List<BankOrder> getBankOrdersByGopayOrderId(String orderId);

    /**
     * 验签成功
     * 
     * @param orderId
     * @return
     */
    public int updateBackSuccess(String orderId);

    /**
     * 银行流水更新为[银行通知订单失败]
     * 
     * @param orderId
     *            订单号
     * @return
     */
    public int updateBackFail(String orderId);
    
    
    /**
     * 验签失败
     * 
     * @param orderId
     * @return
     */
    public int updateQueryBackVerifyFail(String orderId);
    
    
    /**
     * 验签成功
     * 
     * @param orderId
     * @return
     */
    public int updateQueryBackSuccess(String orderId);

    /**
     * 验签失败
     * 
     * @param orderId
     * @return
     */
    public int updateBackVerifyFail(String orderId);
    
    /**
     * BPS对单成功
     * 
     * @return
     */
    public int updateBpsSuccess(String orderId);
    
    /**
     * BPS对单失败
     * 
     * @return
     */
    public int updateBpsFail(String orderId);
    
    /**
     * BPS对单其他
     * 
     * @return
     */
    public int updateBpsOther(String outOrderId);
    
    /**
     * 通知cashier入账失败
     * @param orderId
     * @return
     */
    public int updateInAcctFail(String orderId);
    
    /**
     * 记录前台通知时间
     * @param orderId
     * @return
     */
    public int updateFrontBackTime(String orderId);
    
    /**
     * 根据银行码和查询状态获取交易记录
     * 
     * @param bankCode
     * @param queryOrderStatus
     * @return
     */
    public List<BcdlQueryBalance> getBcdlQueryByBankCodeAndOrderStatus(String bankCode, String queryOrderStatus);
    
    /**
     * 根据查询Id获取查询交易记录
     * 
     * @param orderId
     * @return
     */
    public BcdlQueryBalance getBcdlQueryById(String orderId);
    
    /**
     * 新增银企直联查询余额流水
     * @param queryOrder
     * @return
     */
    public BcdlQueryBalance addBcdlQueryOrder(BcdlQueryBalance queryOrder);
    
    /**
     * 修改银企直联查询流水
     * 
     * @param queryOrder
     */
    public void updateBcdlQueryOrder(BcdlQueryBalance queryOrder);
    
    /**
     * 金额比对异常更新状态
     * @param orderId
     * @return
     */
    public int updateAmountError(String orderId);

	/**
     * 新增银行订单操作日志
     * @param bankOrderDealLog
     */
    public void addBankOrderDealLog(BankOrderDealLog bankOrderDealLog);
    
    /**
     * 查找退款银行流水
     * 
     * @param bankOrderId
     * @return
     */
    public List<BankOrder> getBankOrdersByOriBankOrderId(String bankOrderId);
    
    /**
     * 银行自动路由日志表
     * @param bankOrderDealLog
     */
    public void addBankRouteLog(BankRouteLog bankOrderDealLog);
    
    /**
     * 民生代扣单独更新对账为[银行处理成功]
     * 
     * @param bankOrder
     *           订单 
     * @return
     */
    public int updateQueryBackSuccess(BankOrder bankOrder,String bankOrderStatus);

    /**
     * 民生代扣单独更新对账为[通知验签失败]
     * 
     * @param bankOrder
     *           订单
     * @return
     */
    public int updateQueryBackVerifyFail(BankOrder bankOrder);
    
    public int lock(BankOrder bankOrder);

	public int unlock(BankOrder bankOrder);

	public int updateTotalCheckTimes(BankOrder bankOrder);

	public int updateFail(BankOrder bankOrder);
    /**
     * 修改银企直联表
     * 
     * @param bcdlOrder
     */
    public void updateBankBcdlOrder(BisBankBcdlOrder bcdlOrder);
    /**
     * 
     * 功能描述：增加银行订单扩展表
     *
     * @param bankOrderExt
     * 
     * @author 宣广海
     *
     * @since 2017年4月17日
     *
     * @update:[变更日期YYYY-MM-DD][更改人姓名][变更描述]
     */
    public void addBankOrderExt(BankOrderExt bankOrderExt);
    /**
     * 
     * 功能描述：根据银行订单号查询银行扩展订单
     *
     * @param bankOrderId
     * @return
     * 
     * @author 宣广海
     *
     * @since 2017年4月18日
     *
     * @update:[变更日期YYYY-MM-DD][更改人姓名][变更描述]
     */
    public BankOrderExt getBankOrderExtById(String bankOrderId);
    
    /**
     * 获取银企直连发往银行日志记录
     * @param orderId
     * @return
     */
    public BcdlSendBankLog getBcdlSendLogById(String orderId);
    
    /**
     * 删除银企直连发往银行日志记录
     * @param bcdlSendBankLog
     */
    public void deleteBcdlSendLog(BcdlSendBankLog bcdlSendBankLog);

    /**
     * 插入银企直连发往银行日志记录
     * @param bankOrder
     * zhoutong
     */
    public void saveBcdlSendBankLog(BankOrder bankOrder);

    /**
     * 更新银行返回流水号和状态为成功
     * @param orderId
     * @param bankId
     */
    void updateBackSuccess(String orderId, String bankId);
}
